################################################################################ 
## 
## Hack Title:		Music Online Hack Addon - Users last Song in Profile 
## Hack Version:	1.0.0 
## Hack Author:		Christian_N < N/A > (Christian Nchter) http://www.chantals-fanpage.de  
## Hack Description:	Displays users last uploaded song in his profile. 
##			This Information only diplays when the user have uploaded songs! 
##          
##          
##          
## Installation Level:	Easy 
## Installation Time:	5 Minutes 
## 
## Files To Edit:   3  
##               includes/usercp_viewprofile  
##               language/lang_english/lang_main.php  
##               templates/subSilver/profile_view_body.tpl  
##  
##  
## Included Files:   
##               emff_standard.swf  
## 
################################################################################ 
## The following site also contain the latest version of this MOD: 
## 
## http://www.amigalink.de/phpbb2/viewtopic.php?t=1276
## 
## No support for this MOD! 
## 
##  
##
################################################################################
## Author Notes:
##
## This MOD based on "Album Addon -  Users last pic in Profile v.1.0.2" from AmigaLink!!
##
## Tested with:
## - phpBB 2.0.22
## - Music Online Hack 2.0.6
## - PHP 5.2.3
## - MySQL 5.0.37 
## 
################################################################################ 
##
##
##   2007-10-13 - Version 1.0.0
##	- First Release
##
##
################################################################################ 
##  This hack is released under the GPL License. 
##  This hack can be freely used, but not distributed, without permission. 
##  Intellectual Property Rights are retained by the hack author(s) 
##  listed above. 
## 
################################################################################ 
## 
##  BEFORE ADDING THIS HACK TO YOUR FORUM, please be sure to backup ALL 
##  affected files. 
## 
################################################################################
#
#-----[ COPY ]------------------------------------------
#
copy emff_standard.swf to emff_standard.swf

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/usercp_viewprofile 

# 
#-----[ FIND ]------------------------------------------ 
# 

//
// Generate page
// 

# 
#-----[ REPLACE WITH ]------------------------------------ 
# 

// <!-- BEGIN Users Last Song -->
$music_root_path = $phpbb_root_path . 'music_box/';
include($music_root_path . 'music_common.'.$phpEx);

   $sql = "SELECT song_id, song_title, song_time, song_filename, song_singer FROM " . MUSIC_TABLE . " WHERE song_username='".$profiledata['username']."'
		AND song_approval = 1
		ORDER BY song_time DESC
		LIMIT 1"; 
   if ( !($query_result = $db->sql_query($sql)) ) 
   { 
      message_die(GENERAL_ERROR, 'Could not obtain uploaded songs information', '', __LINE__, __FILE__, $sql); 
   } 
   $result = $db->sql_query($sql);
   $users_last_song_id = '';
   $users_last_song_title = '';
   $users_last_song_singer = '';
   while ($row = $db->sql_fetchrow($result))
   {
	   $users_last_song_id = $row['song_id'];
	   $users_last_song_title = $row['song_title'];
	   $users_last_song_time = $row['song_time'];
	   $users_last_song_singer = $row['song_singer'];
	   $song_filetype = substr($row['song_filename'], strlen($row['song_filename']) - 3, 3);
	   $song_filename = $row['song_filename'];
   }

   if ( $users_last_song_id )
   {
	if ( $song_filetype == 'mp3' )
	{
	   $users_last_song = '<object type="application/x-shockwave-flash" data="emff_standard.swf" width="110" height="34">';
	   $users_last_song .= '<param name="movie" value="emff_standard.swf">';
 	   $users_last_song .= '<param name="wmode" value="transparent">';
 	   $users_last_song .= '<param name="FlashVars" value="src=music_song.php?song_id=' . $users_last_song_id . '">';
	   $users_last_song .= '</object>';
 
	}
	else
	{
	   $users_last_song = '<span class="genmed"><a href="music_page.php?song_id=';
	   $users_last_song .= $users_last_song_id;
	   $users_last_song .= '" class="genmed">';
	   $users_last_song .= $lang['Play'];
	   $users_last_song .= '</a></span>';
	}
   }
   else
   {
	   $users_last_song = '';
   }
// <!-- END Users Last Song -->

//
// Generate page
// 

// <!-- BEGIN Users Last Song -->
$last_song_time = create_date($lang['DATE_FORMAT'], $users_last_song_time, $board_config['board_timezone']);
if ($users_last_song && $userdata['session_logged_in'])
{
	$template->assign_block_vars("users_last_song", array(
		'L_USERS_LAST_SONG' => $lang['Users_Last_Song'],
		'L_PLAY' => $lang['Play'],
		'L_DATE' => $lang['Date'],
		'L_SONG_TITLE' => $lang['Song_Title'],
		'L_SINGER' => $lang['Singer'],
		'LAST_SONG' => $users_last_song,
		'LAST_SONG_SINGER' => $users_last_song_singer,
		'LAST_SONG_TITLE' => $users_last_song_title,
		'LAST_SONG_TIME' => $last_song_time
	));
}
// <!-- END Users Last Song -->


#
#----------[ OPEN ]-------------------------------------
#

language/lang_english/lang_main.php

#
#----------[ FIND ]-------------------------------------
#

//
// Music Online
//
$lang['Music'] = 'Music Online'; // or Media Center


#
#----------[ AFTER, ADD ]-------------------------------
#

$lang['Users_Last_Song'] = 'Newes song in Music Online';
$lang['Play'] = 'Play';


#
#----------[ OPEN ]-------------------------------------
#

templates/subSilver/profile_view_body.tpl

#
#----------[ FIND ]-------------------------------------
#

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
	<td align="right"><span class="nav"><br />{JUMPBOX}</span></td>
  </tr>
</table>
	
#
#----------[ BEFORE, ADD ]-------------------------------
#

<!-- BEGIN users_last_song -->
<br />
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center">
  <tr> 
	<th class="thHead" colspan="4" height="25" nowrap="nowrap">{users_last_song.L_USERS_LAST_SONG}</th>
  </tr>
  <tr> 
	<td class="catLeft" width="15%" align="center"><b><span class="gen">{users_last_song.L_PLAY}</span></b></td>
	<td class="catHead" width="35%" align="center"><b><span class="gen">{users_last_song.L_SONG_TITLE}</span></b></td>
	<td class="catHead" width="35%" align="center"><b><span class="gen">{users_last_song.L_SINGER}</span></b></td>
	<td class="catRight" width="15%" align="center"><b><span class="gen">{users_last_song.L_DATE}</span></b></td>
  </tr>
  <tr>
	<td class="row1" align="center">{users_last_song.LAST_SONG}</td>
	<td class="row1" align="center"><span class="genmed">{users_last_song.LAST_SONG_TITLE}</span></td>
	<td class="row1" align="center"><span class="genmed">{users_last_song.LAST_SONG_SINGER}</span></td>
	<td class="row1" align="center"><span class="genmed">{users_last_song.LAST_SONG_TIME}</span></td>
  </tr>
</table>
<!-- END users_last_song -->

#
#----------[ SAVE AND CLOSE ALL FILES ]-----------------
#
# EoM